//
// Created by Ivor_ on 2022/2/25.
//

#ifndef PHYSICAL_COMPUTING_PACKAGE_MONTECARLO_H
#define PHYSICAL_COMPUTING_PACKAGE_MONTECARLO_H

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>

typedef struct node {
    char attribute;
    int neighbors;
    struct node** neighbor;
} Node;

typedef struct {
    int scales;
    Node* network;
} StdSqrNet;

typedef struct {
    int layers;
    Node* network;
} StdTreeNet;

typedef struct {
    int nodes;
    Node* network;
} ArbGraph;

double sigmoid(double xx);
StdSqrNet createNetworks_stdSqr(int scales);
StdTreeNet createNetworks_stdTree(int layers);
ArbGraph createNetworks_fourDegreeRing(int nodes, int gap);
ArbGraph ssnToAg(StdSqrNet ssn);
ArbGraph stnToAg(StdTreeNet stn);
void randRelinkGraph(ArbGraph* pag, double possibility);
void freeSSN(StdSqrNet ssn);
void freeSTN(StdTreeNet stn);
void freeAG(ArbGraph ag);
double ssnMcApproximate(StdSqrNet* pStdSqrNet, double cost);
double stnMcApproximate(StdTreeNet* pStdTreeNet, double cost);
double agMcApproximate(ArbGraph* pArbGraph, double cost);

double mcIntegral(int mcSteps, double start, double end, double* constantParameters, double (*pFunction)());

#endif //PHYSICAL_COMPUTING_PACKAGE_MONTECARLO_H
